import request from '@/utils/request';
import { hasIsSw, isLianxiSite, isOnlyBinhai } from '../utils/utils';
import { baseurl } from './baseurl';
export async function studentAnalyze(params) {
  /* 学生统计 */
  const year = new Date().getFullYear();
  const data = new FormData();
  data.append('uid', params.uid);
  data.append('subject', params.subject);
  if (isOnlyBinhai()) {
    if (params.hasTime) {
      if (params.hasTime === 1) {
        data.append('start_date', year + '-01-01');
        data.append('end_date', year + '-06-30');
      } else {
        data.append('start_date', year + '-07-01');
        data.append('end_date', year + '-12-31');
      }
    } else {
      data.append('start_date', '');
      data.append('end_date', '');
    }
  }
  const is_sw = JSON.parse(localStorage.getItem('userinfo') || '').is_sw;
  if (hasIsSw()) {
    data.append('is_sw', is_sw);
  }
  return request(`${baseurl}index/index/statistics`, {
    method: 'POST',
    data,
  });
}
